<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="all,follow">

    <title>合同管理</title>
    <link rel="shortcut icon" href="img/favicon.ico">

    <!-- global stylesheets -->
    <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="css/font-icon-style.css">
    <link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">

    <!-- Core stylesheets -->
</head>

<body>
<!--====================================================
                        PAGE CONTENT
======================================================-->
<div class="content-inner form-cont">
    <div class="row">
        <div class="col-md-12">

            <!--***** BASIC FORM *****-->
            <div class="card form" id="form1">
                <div class="card-header">
                    <h3>合同查询</h3>
                </div>
                <br>
                <form name="searchContractForm" method="post">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">合同标题</label>
                                <div class="col-9">
                                    <input name="name" class="form-control" type="text" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label style="width: 85px;margin-left: 20px;"  class=" col-form-label">合同分类</label>
                                <div class="col-9">
                                    <select class="form-control" name="type">
                                        <option value="">选择类型</option>
                                        <option value="销售合同">销售合同</option>
                                        <option value="采购合同">采购合同</option>
                                        <option value="保密合同">保密合同</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">内容</label>
                                <div class="col-9">
                                    <input type="text" name="text" class="form-control">
                                </div>
                            </div>
                        </div>
                    </div>
                    <button type="submit" class="btn btn-general btn-blue mr-2" style="margin-left: 50px;margin-bottom: 20px; float: left;">查询</button>
                    <button type="reset" class="btn btn-general btn-white">重置</button>
                </form>
            </div>
        </div>
    </div>
    <div class="page-content d-flex align-items-stretch">
        <div class="content-inner chart-cont">
            <!--***** CONTENT *****-->
            <div class="row">
                <button type="button" class="btn btn-outline-primary" data-toggle="modal" data-target="#newTemplate">添加模板</button>
                <table class="table table-hover" >
                    <thead>
                    <tr class="bg-info text-white" >
                        <th>id</th>
                        <th>合同标题</th>
                        <th>合同分类</th>
                        <th>编辑时间</th>
                        <th>状态</th>
                        <th style="text-align: center;">操作</th>
                    </tr>
                    </thead>
                    <tbody id="table-detail">
                    <tr th:each="contract:${contracts}">
                        <th th:text="${contract.id}" scope="row">1</th>
                        <td th:text="${contract.name}">模板1</td>
                        <td th:text="${contract.contractType}">xx类</td>
                        <td th:text="${contract.updateTime}">dwqfwawfzfx</td>
                        <td th:text="${contract.contractRecord}?((${contract.contractRecord.hasShare}=='是')?'启用':'禁用')">启用</td>
                        <td style="text-align: center;">
                            <a href="#" th:href="@{~/contract/editContract(id=${contract.id})}" data-toggle="modal" data-target="#updateTemplate">编辑|</a>
                            <a href="#" th:href="@{~/contract/deleteContract(id=${contract.id})}">删除|</a>
                            <a href="#" th:href="@{~/contract/switchShareStatus(id=${contract.id})}" th:text="${contract.contractRecord}?((${contract.contractRecord.hasShare}=='是')?'禁用':'启用')">暂无</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <div  class="c-pages">
                    <div class="cp-item">
                        <span>共</span>
                        <span id="cp-count">0</span>
                        <span>条</span>
                    </div>
                    <div class="cp-item">
                        <span id="curr-page">1</span>
                        <span>/</span>
                        <span id="total-page">1</span>
                    </div>
                    <div class="cp-item">
                        <button id="home" class="btn btn-outline-primary">首页</button>
                        <button id="prev" class="btn btn-outline-primary">上页</button>
                        <input type="number" id="goToPage" />
                        <button id="goTo" class="btn btn-outline-primary">转到</button>
                        <button id="next" class="btn btn-outline-primary">下页</button>
                        <button id="last" class="btn btn-outline-primary">尾页</button>
                    </div>

                </div>
            </div>

        </div>
    </div>
</div>

<!-- 添加模板模态框（Modal） -->
<div class="modal fade" id="newTemplate" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    新增模板
                </h4>
            </div>
            <form name="addContractForm" th:action="@{/contract/addContract}" method="post">
                <div class="modal-body">
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">合同标题：</label>
                        <div class="col-9">
                            <input  class="form-control" type="text" name="name" value="">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">合同分类：</label>
                        <div class="col-9">
                            <select name="contractType" class="form-control">
                                <option value="">选择类型</option>
                                <option value="销售合同" th:selected="${contract.contractType == '销售合同'}">销售合同</option>
                                <option value="采购合同" th:selected="${contract.contractType == '采购合同'}">采购合同</option>
                                <option value="保密合同" th:selected="${contract.contractType == '保密合同'}">保密合同</option>
                                <!--其它合同类型-->
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">简介：</label>
                        <div class="col-9">
                            <textarea name="contractRecord.remark" th:text="${contract.contractRecord.remark}" class="form-control" rows="5"></textarea>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">内容1：</label>
                        <div class="col-9">
                            <textarea name="contractSteps[0].contractItems[0].attributeValue" rows="10" cols="80" class="form-control"></textarea>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">内容2：</label>
                        <div class="col-9">
                            <textarea name="contractSteps[0].contractItems[1].attributeValue"  rows="10" cols="80" class="form-control"></textarea>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-primary">提交</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </form>
        </div><!-- /.modal -->
    </div>
</div>
<!-- 修改模板模态框（Modal） -->
<div class="modal fade" id="updateTemplate" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    编辑模板
                </h4>
            </div>
            <form name="addContractForm" th:action="@{/contract/updateContract}" method="post">
                <div class="modal-body">
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">合同标题：</label>
                        <div class="col-9">
                            <input  class="form-control" type="text" name="name" value="">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">合同分类：</label>
                        <div class="col-9">
                            <select name="contractType" class="form-control">
                                <option value="">选择类型</option>
                                <option value="销售合同">销售合同</option>
                                <option value="采购合同">采购合同</option>
                                <option value="保密合同">保密合同</option>
                                <!--其它合同类型-->
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">简介：</label>
                        <div class="col-9">
                            <textarea name="contractRecord.remark" class="form-control" rows="5"></textarea>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">内容1：</label>
                        <div class="col-9">
                            <textarea name="contractSteps[0].contractItems[0].attributeValue" th:text="${contract.contractSteps[0].contractItems[0].attributeValue}" rows="10" class="form-control"></textarea>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">内容2：</label>
                        <div class="col-9">
                            <textarea name="contractSteps[0].contractItems[1].attributeValue" rows="10" th:text="${contract.contractSteps[0].contractItems[1].attributeValue}" class="form-control"></textarea>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-primary">提交</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                        </button>
                    </div>
            </div><!-- /.modal-content -->
            </form>
        </div><!-- /.modal -->
    </div>
</div>
<!--Global Javascript -->
<script src="js/jquery.min.js"></script>
<script src="js/popper/popper.min.js"></script>
<script src="js/tether.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/chart.min.js"></script>
<script src="js/front.js"></script>
<script src="js/forpage.js"></script>
</body>

</html>